package com.cn.zz.config;

import com.cn.zz.po.MyProperties;
import com.cn.zz.service.DemoService;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zengzeng
 * @description 配置
 * @date 2024/2/12 20:18
 */

@Configuration
@EnableConfigurationProperties(value = MyProperties.class)
public class FreedomConfig {


    private final MyProperties myProperties ;

    public FreedomConfig (MyProperties myProperties) {
        this.myProperties = myProperties;
    }

    @Bean
    public DemoService initBean(){
        System.out.println("myProperties = " + myProperties.getName());
        return new DemoService(myProperties);
    }
}
